import useUserPinia from '~/store/user'

export default defineNuxtRouteMiddleware((to, from) => {
  console.log('路由拦截')
  const userStore = useUserPinia()
  console.log(userStore.state.token, 111111111)
  // isAuthenticated()是一个验证用户是否已经认证的示例方法
  if (!userStore.state.token) {
    return navigateTo('/login')
  }
})
